package com.yztc.yidoutang.fragment.quanwuji_fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.yztc.yidoutang.R;
import com.yztc.yidoutang.adapter.QuanWuAdapter;
import com.yztc.yidoutang.bean.QuanWuListBean;

import java.util.List;

/**
 * Created by My on 2016/10/18.
 */

public class QuanWuJiFragment extends Fragment implements QuanWuJiContract.View{
    private String queryWords="";
    private ListView listView;
    private QuanWuJiContract.Presenter presenter=new QuanWuJiPresenter(this);
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.fragment_quanwuji,null);
        listView= (ListView) view.findViewById(R.id.searchqw_lv);
        initView();
        return view;
    }
    public void initView(){
        Bundle bundle=getArguments();
        queryWords=bundle.getString("queryWords");
        getQWJData();
    }
    @Override
    public void getQWJData() {
        presenter.getQWJData(queryWords);
    }

    @Override
    public void GetQWJDataSuccess(List<QuanWuListBean> listBeen) {
        QuanWuAdapter adapter=new QuanWuAdapter(getActivity(),listBeen);
        listView.setAdapter(adapter);
    }


    @Override
    public void GetQWJDataFail(String msg) {

    }
}
